package com.travel.pojo;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import lombok.Data;

/**
 * 航班表
 * @TableName flight
 */
@TableName(value ="flight")
@Data
public class Flight implements Serializable {
    /**
     * 航班id
     */
    @TableId(value = "id", type = IdType.AUTO)
    private Integer id;

    /**
     * 所在机场id,对应airport表的id
     */
    @TableField(value = "airport_id")
    private Integer airportId;

    /**
     * 航空公司的id
     */
    @TableField(value = "company_id")
    private Integer companyId;

    /**
     * 飞机起飞时间
     */
    @TableField(value = "departure_time")
    private LocalDateTime departureTime;

    /**
     * 飞机降落时间
     */
    @TableField(value = "landing_time")
    private LocalDateTime landingTime;

    /**
     * 起飞机场id
     */
    @TableField(value = "departure_airport")
    private Integer departureAirport;

    /**
     * 降落机场id
     */
    @TableField(value = "landing_airport")
    private Integer landingAirport;

    /**
     * 退改费用
     */
    @TableField(value = "refund_fee")
    private BigDecimal refundFee;

    /**
     * 托运行李额
     */
    @TableField(value = "baggage_allowance")
    private Double baggageAllowance;

    /**
     * 航班座位类型(1、经济舱  2、公务/头等舱)
     */
    @TableField(value = "flight_seat_type")
    private Integer flightSeatType;

    /**
     * 剩余机票数量
     */
    @TableField(value = "remaining_amount")
    private Integer remainingAmount;

    /**
     * 价格
     */
    @TableField(value = "price")
    private BigDecimal price;

    @TableField(exist = false)
    private static final long serialVersionUID = 1L;

    @Override
    public boolean equals(Object that) {
        if (this == that) {
            return true;
        }
        if (that == null) {
            return false;
        }
        if (getClass() != that.getClass()) {
            return false;
        }
        Flight other = (Flight) that;
        return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
            && (this.getAirportId() == null ? other.getAirportId() == null : this.getAirportId().equals(other.getAirportId()))
            && (this.getCompanyId() == null ? other.getCompanyId() == null : this.getCompanyId().equals(other.getCompanyId()))
            && (this.getDepartureTime() == null ? other.getDepartureTime() == null : this.getDepartureTime().equals(other.getDepartureTime()))
            && (this.getLandingTime() == null ? other.getLandingTime() == null : this.getLandingTime().equals(other.getLandingTime()))
            && (this.getDepartureAirport() == null ? other.getDepartureAirport() == null : this.getDepartureAirport().equals(other.getDepartureAirport()))
            && (this.getLandingAirport() == null ? other.getLandingAirport() == null : this.getLandingAirport().equals(other.getLandingAirport()))
            && (this.getRefundFee() == null ? other.getRefundFee() == null : this.getRefundFee().equals(other.getRefundFee()))
            && (this.getBaggageAllowance() == null ? other.getBaggageAllowance() == null : this.getBaggageAllowance().equals(other.getBaggageAllowance()))
            && (this.getFlightSeatType() == null ? other.getFlightSeatType() == null : this.getFlightSeatType().equals(other.getFlightSeatType()))
            && (this.getRemainingAmount() == null ? other.getRemainingAmount() == null : this.getRemainingAmount().equals(other.getRemainingAmount()))
            && (this.getPrice() == null ? other.getPrice() == null : this.getPrice().equals(other.getPrice()));
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
        result = prime * result + ((getAirportId() == null) ? 0 : getAirportId().hashCode());
        result = prime * result + ((getCompanyId() == null) ? 0 : getCompanyId().hashCode());
        result = prime * result + ((getDepartureTime() == null) ? 0 : getDepartureTime().hashCode());
        result = prime * result + ((getLandingTime() == null) ? 0 : getLandingTime().hashCode());
        result = prime * result + ((getDepartureAirport() == null) ? 0 : getDepartureAirport().hashCode());
        result = prime * result + ((getLandingAirport() == null) ? 0 : getLandingAirport().hashCode());
        result = prime * result + ((getRefundFee() == null) ? 0 : getRefundFee().hashCode());
        result = prime * result + ((getBaggageAllowance() == null) ? 0 : getBaggageAllowance().hashCode());
        result = prime * result + ((getFlightSeatType() == null) ? 0 : getFlightSeatType().hashCode());
        result = prime * result + ((getRemainingAmount() == null) ? 0 : getRemainingAmount().hashCode());
        result = prime * result + ((getPrice() == null) ? 0 : getPrice().hashCode());
        return result;
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append(getClass().getSimpleName());
        sb.append(" [");
        sb.append("Hash = ").append(hashCode());
        sb.append(", id=").append(id);
        sb.append(", airportId=").append(airportId);
        sb.append(", companyId=").append(companyId);
        sb.append(", departureTime=").append(departureTime);
        sb.append(", landingTime=").append(landingTime);
        sb.append(", departureAirport=").append(departureAirport);
        sb.append(", landingAirport=").append(landingAirport);
        sb.append(", refundFee=").append(refundFee);
        sb.append(", baggageAllowance=").append(baggageAllowance);
        sb.append(", flightSeatType=").append(flightSeatType);
        sb.append(", remainingAmount=").append(remainingAmount);
        sb.append(", price=").append(price);
        sb.append(", serialVersionUID=").append(serialVersionUID);
        sb.append("]");
        return sb.toString();
    }
}